package com.woniu.bh.beautysalon.web.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.woniu.bh.beautysalon.model.dto.CouponsDto;
import com.woniu.bh.common.core.domain.coupon.BeautysalonCoupon;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**

 * @author daniel
 * @since 2020-10-16
 */
public interface BeautysalonCouponMapper extends BaseMapper<BeautysalonCoupon> {
    @Select("SELECT coupon_name,coupon_desc,coupon_facevalue,coupon_img,coupon_type\n" +
            ",beautysalon_coupon_start_time,beautysalon_coupon_end_time,beautysalon_coupon_time,\n" +
            "beautysalon_coupon_take_count,beautysalon_coupon_used_count,coupon_valid_time from bh_coupon c LEFT JOIN bh_beautysalon_coupon b\n" +
            "on c.coupon_id = b.beautysalon_coupon_coupon_id where beautysalon_coupon_beautysalon_id =#{beautysalonId} ")
    List<CouponsDto> getAllCoupons(Integer beautysalonId);
}
